﻿using MgSoft.Excel.Util;
using System;
using System.Collections.Generic;
using System.Text;

namespace MgSoft.Excel
{
    public class ExcelErrorMessage
    {
        //public static List<ErrorMessage> Messages = new List<ErrorMessage>();

        public ExcelErrorMessage()
        {
        }
        public ExcelErrorMessage(string message = "", string detailed = "")
        {
            Message = message;
            Detailed = detailed;
        }

        public ExcelErrorMessage(int rowIndex, int columnIndex, string message="",string detailed="")
        {
            RowIndex = rowIndex;
            ColumnIndex = columnIndex;
            Message = message;
            Detailed = detailed;
        }

        public int? RowIndex { get; set; }

        public int? ColumnIndex { get; set; }

        public string ColumnName 
        {
            get
            {
                if (!ColumnIndex.HasValue) return "";
                return SheetColumnNameUtil.ColumnIndexToColumnName(ColumnIndex.Value);
            }
            set
            {
                ColumnIndex =SheetColumnNameUtil.ColumnNameToColumnIndex(value);    
            }
        }

        public string Message { get; set; }

        public string Detailed { get; set; }

        //public static void Clean()
        //{
        //    Messages = new List<ErrorMessage>();
        //}

        //public static void Add(ErrorMessage errorMessage)
        //{
        //    Messages.Add(errorMessage);
        //}
    }
}
